package xinyou.jh.net.login
{
	import xinyou.jh.net.SocketManager;
	import xinyou.jh.net.JHReceiver;
	import xinyou.net.SocketConnection;
	import xinyou.net.receiver.BaseReceiver;
	
	
	public class LoginReceiver extends JHReceiver
	{
		public function LoginReceiver(socket:SocketConnection)
		{
			super(socket);
		}
		
		override protected function initCallBack():void
		{
			addCallBack([10,1],serverReady);
			addCallBack([10,3],checkVersion);
			addCallBack([10,5],loginResult);
			addCallBack([10,9],serverInfo);
			addCallBack([10,11],loginError);
		}
		public function serverReady(result:Object):void
		{
			SocketManager.getInstance().dispatchEvent(new LoginEvent(LoginEvent.SERVERREADY,result));//服务器准备完成
		}
		public function checkVersion(result:Object):void
		{
			SocketManager.getInstance().dispatchEvent(new LoginEvent(LoginEvent.CHECKVERSION,result));//版本验证
		}
		public function loginResult(result:Object):void
		{
			SocketManager.getInstance().dispatchEvent(new LoginEvent(LoginEvent.LOGINRESULT,result));//登陆结果
		}
		public function serverInfo(result:Object):void
		{
			SocketManager.getInstance().dispatchEvent(new LoginEvent(LoginEvent.MAINSERVERINFO,result));//主服务器信息
		}
		public function loginError(result:Object):void
		{
			t0(result.szErrorDesc);
		}
		
	}
}